# 操作excel

import xlrd

# 1. 打开xlsx 文件
xlsx = xlrd.open_workbook('d:/testData.xls')

# 2. 获取指定的标签页
table = xlsx.sheet_by_index(0)

# 3. 获取表格中有几行
nrows = table.nrows

# 4. 进行循环统计操作
total = 0
count = 0
for i in range(1,nrows):
    #     获取当前同学的班级 id
    # print('--------------------------------')
    # print(table.cell_value(i,0))
    # print(table.cell_value(i,1))

    classId = table.cell_value(i,1)
    if classId == 100:
        total += table.cell_value(i,2)
        count += 1
print(f'平均分：{total / count}')